from appium.webdriver.common.appiumby import AppiumBy

from Page.base_page import AppBasePage


class SearchPage(AppBasePage):

    def __init__(self):
        super().__init__()
        self.goods_msg_locator = (AppiumBy.ID, 'com.tpshop.malls:id/product_name_tv')
        self.goods_detail_locator = (AppiumBy.ID, 'com.tpshop.malls:id/product_pic_img')

    def goods_msg(self):
        text = self.find_el(*self.goods_msg_locator).text
        return text

    # 进入商品详细
    def goods_detail(self):
        self.find_el(*self.goods_detail_locator).click()